package blog.entity;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 文章
 * @author zhangchao
 */
@Data
public class Article {
    //文章自增Id
    private Integer articleId;

    //创建文章的用户(文章所有者)
    private Integer articleUserId;

    //文章标题
    private String articleTitle;

    //浏览次数
    private Integer articleViewCount;

    //回复次数 / 评论次数
    private Integer articleCommentCount;

    //喜欢次数
    private Integer articleLikeCount;

    //创建时间
    private Date articleCreateTime;

    //更新时间
    private Date articleUpdateTime;

    //是否回复
    private Integer articleIsComment;

    //状态 (0 草稿 1发布)
    private Integer articleStatus;

    //排序
    private Integer articleOrder;

    //文章内容
    private String articleContent;

    //文章概要-取文章内容的前几个字
    private String articleSummary;

    //用户
    private User user;

    //文章挂有哪些标签
    private List<Tag> tagList;

    //文章属于哪些分类
    private List<CateGory> categoryList;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Article article = (Article) o;
        return Objects.equals(articleId, article.articleId) &&
                Objects.equals(articleUserId, article.articleUserId) &&
                Objects.equals(articleTitle, article.articleTitle) &&
                Objects.equals(articleViewCount, article.articleViewCount) &&
                Objects.equals(articleCommentCount, article.articleCommentCount) &&
                Objects.equals(articleLikeCount, article.articleLikeCount) &&
                Objects.equals(articleCreateTime, article.articleCreateTime) &&
                Objects.equals(articleUpdateTime, article.articleUpdateTime) &&
                Objects.equals(articleIsComment, article.articleIsComment) &&
                Objects.equals(articleStatus, article.articleStatus) &&
                Objects.equals(articleOrder, article.articleOrder) &&
                Objects.equals(articleContent, article.articleContent) &&
                Objects.equals(articleSummary, article.articleSummary) &&
                Objects.equals(user, article.user) &&
                Objects.equals(tagList, article.tagList) &&
                Objects.equals(categoryList, article.categoryList);
    }

    @Override
    public int hashCode() {
        return Objects.hash(articleId, articleUserId, articleTitle, articleViewCount, articleCommentCount, articleLikeCount, articleCreateTime, articleUpdateTime, articleIsComment, articleStatus, articleOrder, articleContent, articleSummary, user, tagList, categoryList);
    }
}
